<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2021-10-14-m</title>
</head>

<body>
    <script>
        //算术运算      + - * /  %  += -= *=  /= ++ --
        // var a = 10;
        // 声明多个，逗号隔开
        var b = 10,
            c = 20;
        // console.log(b + c);
        // console.log(b - c);
        // console.log(b * c);
        // console.log(b / c);
        // console.log(b % c);
        // console.log(b += 5);
        console.log(b++); //10
        console.log(b); //11
        //比较运算 >  >=   <   <=   ==    !=   ===    !==  结果为boolean
        var x = 10,
            y = 20,
            z = "10";
        console.log(x > y); //false
        console.log(x == z); //true
        console.log(x === z); //false   比较类型和值
        console.log(x + z); //1010  数值加字符串结果为字符串  +为连接
        console.log(x + Number(z)); //1010  数值加字符串结果为字符串  +为连接
        // 连接运算+
        var html = "";
        html += "<ul>";
        html += "<li>你好</li>";
        html += "</ul>";
        console.log(html);
        // 反引号`（大段拼接） 包含所有内容不需要用+拼接，里面可以换行  能够解析js变量${变量名}
        var id = 10;
        var html2 = `<ul>
                        <li>标题${id}</li>
                    </ul>`;
        console.log(html2);
        // 逻辑运算
        // &&(同时满足，同为真才为真，前面为假，则后面不执行)   ||（一个为真即为真）   !



        var i;
        console.log(i + x); //NaN(not a nmumber)
        var i = null;
        console.log(i + x); //10
        console.log(i + z); //null10
    </script>
</body>

</html>